package com.arron.vistor;

import java.util.ArrayList;
import java.util.List;

/**
 * 员工列表类：对象结构
 */
public class EmployeeList {
    //定义一个集合用于存储员工对象
    private List<Employee> list =new ArrayList<Employee>();
    public void addEmployee(Employee employee){
        list.add(employee);
    }

    public void accept(Department handler){
        for (Object obj :list){
            ((Employee)obj).accept(handler);
        }
    }
}
